﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    Theme="SkinFile" CodeFile="SearchMaster.aspx.cs" Inherits="Pages_SearchMaster" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
    <div>
        <script language="JavaScript" type="text/javascript">
            /*  window.onload = function () {
            document.getElementById('txtDate').readonly = true;
            alert(document.getElementById('txtDate').readonly);
            document.getElementById('txtFromDate').readonly = true;
            document.getElementById('txtToDate').readonly = true;
            }*/
            function Reject() {

                var com = document.getElementById('trComment');
                com.style.display = 'block';
                var btn = document.getElementById("<%=btncreateBill.ClientID%>");
                btn.style.display = 'none';

            }

            function DisableControl(args) {
               // alert(document.getElementById("<%=txtFromDate.ClientID%>").readOnly);
                if (document.getElementById("<%=txtDate.ClientID%>") != null) {
                    document.getElementById("<%=txtDate.ClientID%>").readOnly = true;
                }
                if (document.getElementById("<%=txtFromDate.ClientID%>") != null) {
                    document.getElementById("<%=txtFromDate.ClientID%>").readOnly = true;
                }
                if (document.getElementById("<%=txtToDate.ClientID%>") != null) {
                    document.getElementById("<%=txtToDate.ClientID%>").readOnly = true;
                }
            }
        </script>
        
        <center>
            <div id="dvError" runat="server" style="color:Red">
            </div>
            <asp:Panel ID="PanComp" runat="server" Visible="false">
                <hr />
                <table width="100%">
                    <tr>
                        <td align="left">
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            <asp:GridView ID="grdCOmpany" runat="server" AutoGenerateColumns="False" AllowPaging="True"
                                PageSize="7" Width="100%" AllowSorting="True" BackColor="White" BorderColor="White"
                                OnRowCommand="grdComp_RowCommand" BorderStyle="Ridge" BorderWidth="2px" CellPadding="3"
                                GridLines="None" CellSpacing="1" DataKeyNames="CompanyId" 
                                onrowdatabound="grdCOmpany_RowDataBound">
                                <Columns>
                                    <asp:TemplateField HeaderText="Type">
                                        <ItemTemplate>
                                        <asp:HiddenField ID="IsDelete" runat="server" Value='<%# DataBinder.Eval(Container.DataItem, "IsDelete").ToString() %>' />
                                        <asp:HiddenField ID="hdnId" runat="server" Value='<%# DataBinder.Eval(Container.DataItem, "CompanyId").ToString() %>' />
                                            <asp:LinkButton ID="lbnCompanyType" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "CompanyType").ToString() %>'
                                                PostBackUrl='<%#GetCompURL(DataBinder.Eval(Container.DataItem, "CompanyId").ToString(),DataBinder.Eval(Container.DataItem, "Status").ToString())%>'></asp:LinkButton>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField HeaderText="Type" Visible="false" ReadOnly="True" DataField="CompanyType" />
                                    <asp:BoundField HeaderText="Name" ReadOnly="True" DataField="CompanyName" />
                                    <asp:BoundField HeaderText="Address" ReadOnly="True" DataField="CompanyAddress" />
                                    <asp:BoundField HeaderText="Contact No" ReadOnly="True" DataField="CompanyContact" />
                                    <asp:BoundField HeaderText="Email Id" ReadOnly="True" DataField="CompanyEmail" />
                                    <asp:BoundField HeaderText="VAT/TIN No" ReadOnly="True" DataField="CompanyVatTIN" />
                                    <asp:BoundField HeaderText="Status" ReadOnly="True" DataField="Status" />
                                    <asp:TemplateField HeaderText="Logo">
                                        <ItemTemplate>
                                            <asp:Image ID="imgSaved" runat="server" Height="50px" Width="50px" ImageUrl='<%# ImageURL(DataBinder.Eval(Container.DataItem, "CompanyId").ToString(),"C",1) %>' />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                   <asp:TemplateField HeaderText="Delete" >
                                    <ItemTemplate>
                                    <asp:LinkButton ID="lbnDelete" runat="server" Text="Delete" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>" CommandName="DeleteMaster"></asp:LinkButton>
                                    <ajaxToolkit:ConfirmButtonExtender ID="cnfrm" runat="server" ConfirmText="Are you sure you want to delete this record.After deleting the record you have no longer access to it.Do you wish to continue?" TargetControlID="lbnDelete"></ajaxToolkit:ConfirmButtonExtender>
                                    </ItemTemplate>
                                    </asp:TemplateField>                                    
                                    <asp:BoundField DataField="CompanyId" Visible="false"/>
                                </Columns>
                                <FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
                                <PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" />
                                <SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
                                <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" />
                                <RowStyle BackColor="#DEDFDE" ForeColor="Black" />
                            </asp:GridView>
                        </td>
                    </tr>
                </table>
            </asp:Panel>
            <asp:Panel ID="dvChallan" runat="server" Visible="false">
                <hr />
                <table width="100%" border="0">
                    <tr>
                        <td align="left">
                            Challan No:
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtChallanNo" runat="server"></asp:TextBox>
                        </td>
                        <td align="left">
                            Status:
                        </td>
                        <td align="left">
                            <asp:DropDownList ID="ddlStatus" runat="server">
                                <asp:ListItem Text="Please Select Status" Value="-1" Selected="true"></asp:ListItem>
                                <asp:ListItem Text="InComplete" Value="0"></asp:ListItem>
                                <asp:ListItem Text="Completed" Value="1"></asp:ListItem>
                            </asp:DropDownList>
                        </td>
                        <td align="left">
                            <asp:Button ID="btnSearch" SkinID="DefaultButton" runat="server" Text="Search" OnClick="btnSearch_Click" />
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            Challan Date:
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtDate" runat="server"></asp:TextBox>
                            <ajaxToolkit:CalendarExtender ID="calExtn" runat="server" TargetControlID="txtDate"
                                Format="MMMM d, yyyy" PopupPosition="BottomRight" />
                        </td>
                        <td align="left">
                            Transport Company:
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtTransport" runat="server"></asp:TextBox>
                        </td>
                        <td align="left">
                        </td>
                    </tr>
                    <tr>
                        <td align="left" colspan="5">
                            <hr />
                            <asp:GridView ID="grdChallan" runat="server" AutoGenerateColumns="False" AllowPaging="True" onrowdatabound="grdChallan_RowDataBound"
                                PageSize="7" Width="100%" AllowSorting="True" BackColor="White" BorderColor="White"
                                BorderStyle="Ridge" BorderWidth="2px" CellPadding="3" GridLines="None" OnPageIndexChanging="grdChallan_PageIndexChanging"
                                CellSpacing="1" OnRowCommand="grdChallan_RowCommand">
                                <Columns>
                                    <asp:TemplateField HeaderText="Challan No">
                                        <ItemTemplate>
                                         <asp:HiddenField ID="IsDelete" runat="server" Value='<%# DataBinder.Eval(Container.DataItem, "IsDelete").ToString() %>' />
                                        <asp:HiddenField ID="hdnId" runat="server" Value='<%# DataBinder.Eval(Container.DataItem, "ChallanId").ToString() %>' />
                                            <asp:LinkButton ID="lbnChallanNo" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ChallanNo").ToString() %>'
                                                PostBackUrl='<%#GetChallan(DataBinder.Eval(Container.DataItem, "ChallanId").ToString(),DataBinder.Eval(Container.DataItem, "Status").ToString())%>'></asp:LinkButton>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField HeaderText="Challan Date" Visible="true" ReadOnly="True" DataField="ChallanDate" />
                                    <asp:BoundField HeaderText="Weight" ReadOnly="True" DataField="CFT" />
                                    <asp:BoundField HeaderText="Ticket No" ReadOnly="True" DataField="TicketNo" />
                                    <asp:BoundField HeaderText="Material" ReadOnly="True" DataField="Material" />
                                    <asp:BoundField HeaderText="Transport Company" ReadOnly="True" DataField="TransportCompany" />
                                    <asp:BoundField HeaderText="Supplier Company" ReadOnly="True" DataField="SupplierCompany" />
                                    <asp:BoundField HeaderText="TruckNo" ReadOnly="True" DataField="TruckNo" />
                                    <asp:BoundField HeaderText="Driver Name" ReadOnly="True" DataField="Driver" />
                                    <asp:BoundField HeaderText="Cleaner Name" ReadOnly="True" DataField="Cleaner" />
                                    <asp:BoundField HeaderText="Approval Status" ReadOnly="True" DataField="Status" />
                                    <asp:BoundField HeaderText="Completion Status" ReadOnly="True" DataField="Completed" />
                                    <asp:TemplateField HeaderText="Challan Copy">
                                        <ItemTemplate>
                                            <asp:Image ID="imgSaved" runat="server" Height="50px" Width="50px" ImageUrl='<%# ImageURL(DataBinder.Eval(Container.DataItem, "ChallanId").ToString(),"CH",1) %>' />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                   <asp:TemplateField HeaderText="Delete" >
                                    <ItemTemplate>
                                    <asp:LinkButton ID="lbnDelete" runat="server" Text="Delete" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>" CommandName="DeleteMaster"></asp:LinkButton>
                                    <ajaxToolkit:ConfirmButtonExtender ID="cnfrm" runat="server" ConfirmText="Are you sure you want to delete this record.After deleting the record you have no longer access to it.Do you wish to continue?" TargetControlID="lbnDelete"></ajaxToolkit:ConfirmButtonExtender>
                                    </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField DataField="ChallanId" ReadOnly="True" Visible="False" />
                                </Columns>
                                <FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
                                <PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" />
                                <SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
                                <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" />
                                <RowStyle BackColor="#DEDFDE" ForeColor="Black" />
                            </asp:GridView>
                        </td>
                    </tr>
                </table>
            </asp:Panel>
            <asp:Panel ID="dvTruck" Visible="false" runat="server">
                <hr />
                <table width="100%">
                    <tr>
                        <td align="left">
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            <asp:GridView ID="grdVehicle" runat="server" AutoGenerateColumns="False" AllowPaging="True"
                                PageSize="12" Width="100%" AllowSorting="True" BackColor="White" BorderColor="White" OnRowCommand="grdTruck_RowCommand"
                                BorderStyle="Ridge" BorderWidth="2px" CellPadding="3" GridLines="None" OnPageIndexChanging="grdVehicle_PageIndexChanging"
                                CellSpacing="1">
                                <Columns>
                                    <asp:TemplateField HeaderText="Truck Number">
                                        <ItemTemplate>
                                        <asp:HiddenField ID="hdnId" runat="server" Value='<%# DataBinder.Eval(Container.DataItem, "VehicleId").ToString() %>' />
                                            <asp:LinkButton ID="lbnVehicleNo" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "VehicleNo").ToString() %>'
                                                PostBackUrl='<%#GetTruckURL(DataBinder.Eval(Container.DataItem, "VehicleId").ToString(),DataBinder.Eval(Container.DataItem, "Status").ToString())%>'></asp:LinkButton>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField HeaderText="Truck Model" Visible="true" ReadOnly="True" DataField="VehicleModel" />
                                    <asp:BoundField HeaderText="Purchase Date" ReadOnly="True" DataField="VehiclePurchaseDate" />
                                    <asp:BoundField HeaderText="Status" ReadOnly="True" DataField="Status" />
                                   <asp:TemplateField HeaderText="Delete" >
                                    <ItemTemplate>
                                    <asp:LinkButton ID="lbnDelete" runat="server" Text="Delete" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>" CommandName="DeleteMaster"></asp:LinkButton>
                                    <ajaxToolkit:ConfirmButtonExtender ID="cnfrm" runat="server" ConfirmText="Are you sure you want to delete this record.After deleting the record you have no longer access to it.Do you wish to continue?" TargetControlID="lbnDelete"></ajaxToolkit:ConfirmButtonExtender>
                                    </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField DataField="VehicleId" ReadOnly="True" Visible="False" />
                                </Columns>
                                <FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
                                <PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" />
                                <SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
                                <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" />
                                <RowStyle BackColor="#DEDFDE" ForeColor="Black" />
                            </asp:GridView>
                        </td>
                    </tr>
                </table>
            </asp:Panel>
            <asp:Panel ID="dvEmployee" Visible="false" runat="server">
                <hr />
                <table width="100%">
                    <tr>
                        <td align="left">
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            <asp:GridView ID="grdEmployee" runat="server" AutoGenerateColumns="False" AllowPaging="True"
                                PageSize="7" Width="100%" AllowSorting="True" BackColor="White" BorderColor="White" OnRowCommand="grdEmployee_RowCommand"
                                BorderStyle="Ridge" BorderWidth="2px" CellPadding="3" GridLines="None" OnPageIndexChanging="grdEmployee_PageIndexChanging"
                                CellSpacing="1">
                                <Columns>
                                    <asp:TemplateField HeaderText="Employee No">
                                        <ItemTemplate><asp:HiddenField ID="hdnId" runat="server" Value='<%# DataBinder.Eval(Container.DataItem, "EmployeeId").ToString() %>' />
                                            <asp:LinkButton ID="lbnEmpNo" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "EmployeeNo").ToString() %>'
                                                PostBackUrl='<%#GetEmpURL(DataBinder.Eval(Container.DataItem, "EmployeeId").ToString(),DataBinder.Eval(Container.DataItem, "Status").ToString())%>'></asp:LinkButton>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField HeaderText="Name" Visible="true" ReadOnly="True" DataField="EmployeeName" />
                                    <asp:BoundField HeaderText="Address" ReadOnly="True" DataField="EmployeeAddress" />
                                    <asp:BoundField HeaderText="Contact No" ReadOnly="True" DataField="EmployeeContactNo" />
                                    <asp:BoundField HeaderText="Status" ReadOnly="True" DataField="Status" />
                                    <asp:TemplateField HeaderText="ID Proof">
                                        <ItemTemplate>
                                            <asp:Image ID="imgIDPRoof" runat="server" Height="50px" Width="50px" ImageUrl='<%# ImageURL(DataBinder.Eval(Container.DataItem, "EmployeeId").ToString(),"E",1) %>' />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Licence">
                                        <ItemTemplate>
                                            <asp:Image ID="imgLicence" runat="server" Height="50px" Width="50px" ImageUrl='<%# ImageURL(DataBinder.Eval(Container.DataItem, "EmployeeId").ToString(),"E",2) %>' />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                  <asp:TemplateField HeaderText="Delete" >
                                    <ItemTemplate>
                                    <asp:LinkButton ID="lbnDelete" runat="server" Text="Delete" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>" CommandName="DeleteMaster"></asp:LinkButton>
                                    <ajaxToolkit:ConfirmButtonExtender ID="cnfrm" runat="server" ConfirmText="Are you sure you want to delete this record.After deleting the record you have no longer access to it.Do you wish to continue?" TargetControlID="lbnDelete"></ajaxToolkit:ConfirmButtonExtender>
                                    </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField DataField="EmployeeId" ReadOnly="True" Visible="False" />
                                </Columns>
                                <FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
                                <PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" />
                                <SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
                                <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" />
                                <RowStyle BackColor="#DEDFDE" ForeColor="Black" />
                            </asp:GridView>
                        </td>
                    </tr>
                </table>
            </asp:Panel>
            <asp:Panel ID="dvMaterial" Visible="false" runat="server">
                <hr />
                <table width="100%">
                    <tr>
                        <td align="left">
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            <asp:GridView ID="grdMaterial" runat="server" AutoGenerateColumns="False" AllowPaging="True"
                                PageSize="12" Width="100%" AllowSorting="True" BackColor="White" 
                                BorderColor="White" OnRowCommand="grdMaterial_RowCommand"
                                BorderStyle="Ridge" BorderWidth="2px" CellPadding="3" GridLines="None" OnPageIndexChanging="grdMaterial_PageIndexChanging"
                                CellSpacing="1">
                                <Columns>
                                 
                                    <asp:TemplateField HeaderText="Material Name">
                                        <ItemTemplate>
                                        <asp:HiddenField ID="hdnId" runat="server" Value='<%# DataBinder.Eval(Container.DataItem, "MaterialId").ToString() %>' />
                                            <asp:LinkButton ID="lbnVehicleNo" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "MaterialName").ToString() %>'
                                                PostBackUrl='<%#GetMaterialURL(DataBinder.Eval(Container.DataItem, "MaterialId").ToString(),DataBinder.Eval(Container.DataItem, "Status").ToString())%>'></asp:LinkButton>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField HeaderText="Description" ReadOnly="True" DataField="Description" />
                                    <asp:BoundField HeaderText="Status" ReadOnly="True" DataField="Status" /> 
                                    <asp:TemplateField HeaderText="Delete" >
                                    <ItemTemplate>
                                    <asp:LinkButton ID="lbnDelete" runat="server" Text="Delete" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>" CommandName="DeleteMaster"></asp:LinkButton>
                                    <ajaxToolkit:ConfirmButtonExtender ID="cnfrm" runat="server" ConfirmText="Are you sure you want to delete this record.After deleting the record you have no longer access to it.Do you wish to continue?" TargetControlID="lbnDelete"></ajaxToolkit:ConfirmButtonExtender>
                                    </ItemTemplate>
                                    </asp:TemplateField>
                                       <asp:BoundField DataField="MaterialId" ReadOnly="True" Visible="False"  />
                                </Columns>
                                <FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
                                <PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" />
                                <SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
                                <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" />
                                <RowStyle BackColor="#DEDFDE" ForeColor="Black" />
                            </asp:GridView>
                        </td>
                    </tr>
                </table>
            </asp:Panel>
            <asp:Panel ID="panBill" runat="server" Visible="false">
                <hr />
                <div>
                    <center>
                        <div id="dvCreate" runat="server">
                            <table width="80%">
                                <tr>
                                    <td align="left">
                                        Transport Company:
                                    </td>
                                    <td align="left">
                                        <asp:DropDownList ID="ddlTransportComp" runat="server" Width="60%">
                                        </asp:DropDownList>
                                    </td>
                                    <td align="left">
                                        From Date:
                                    </td>
                                    <td align="left">
                                        <asp:TextBox ID="txtFromDate" runat="server" Width="90%"></asp:TextBox>
                                        <ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtFromDate"
                                            Format="MMMM d, yyyy" PopupPosition="BottomRight" />
                                        <asp:RequiredFieldValidator ID="REQfROMdATE" runat="server" ValidationGroup="Bill"
                                            Text="*" ErrorMessage="From Date is Required" ControlToValidate="txtFromDate"></asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="left">
                                        Contractor Company:
                                    </td>
                                    <td align="left">
                                        <asp:DropDownList ID="ddlContractorComp" runat="server" Width="60%">
                                        </asp:DropDownList>
                                    </td>
                                    <td align="left">
                                        To Date:
                                    </td>
                                    <td align="left">
                                        <asp:TextBox ID="txtToDate" runat="server" Width="90%"></asp:TextBox>
                                        <ajaxToolkit:CalendarExtender ID="customCalendarExtender" runat="server" TargetControlID="txtToDate"
                                            Format="MMMM d, yyyy" PopupPosition="BottomRight" />
                                        <asp:RequiredFieldValidator ID="reqToDate" runat="server" ValidationGroup="Bill"
                                            Text="*" ErrorMessage="To Date is Required" ControlToValidate="txtToDate"></asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="left">
                                        Material:
                                    </td>
                                    <td align="left">
                                        <asp:DropDownList ID="ddlMaterial" runat="server" Width="60%">
                                        </asp:DropDownList>
                                    </td>
                                    <td colspan="2" align="left">
                                        <asp:Button ID="btnSerchChallan" runat="server" ValidationGroup="Bill" SkinID="DefaultButton"
                                            Text="Search" OnClick="btnSearchChallan_Click" />
                                        <asp:Button ID="btncreateBill" SkinID="DefaultButton" runat="server" Text="Generate Bill"
                                            Enabled="false" OnClientClick="javascript:Reject(); return false;" />
                                        <asp:ValidationSummary ID="valSumBill" runat="server" ShowSummary="true" DisplayMode="BulletList" />
                                    </td>
                                </tr>
                            </table>
                            <div id="trComment" style="display: none">
                                <table width="60%" cellpadding="4" cellspacing="4">
                                    <tr valign="top">
                                        <td align="left" colspan="2">
                                            Please Enter Rate:<asp:TextBox ID="txtRate" runat="server"></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="reqVal" runat="server" ControlToValidate="txtRate"
                                                Text="*" ErrorMessage="Rate is required" ValidationGroup="RejectCH">
                                            </asp:RequiredFieldValidator>
                                        </td>
                                        <td valign="middle">
                                            <asp:Button ID="btnGenerateBill" runat="server" SkinID="DefaultButton" Text="Generate Bill"
                                                Enabled="false" OnClick="btnGenerateBill_Click" ValidationGroup="RejectCH" />
                                        </td>
                                        <td>
                                            <asp:ValidationSummary ID="valSum" runat="server" ShowSummary="true" ValidationGroup="RejectCH" />
                                        </td>
                                    </tr>
                                </table>
                            </div>
                            <table width="100%">
                                <tr>
                                    <td colspan="4">
                                        <asp:GridView ID="grdBill" runat="server" BackColor="White" BorderColor="White" BorderStyle="Ridge"
                                            BorderWidth="2px" CellPadding="3" CellSpacing="1" GridLines="None" AutoGenerateColumns="False"
                                            AllowPaging="True" AllowSorting="True" OnPreRender="grdBill_PreRender" PageSize="450" Height="50px" 
                                            OnPageIndexChanging="grdBill_PageIndexChanging">
                                            <Columns>
                                                <asp:TemplateField HeaderText="Select">
                                                    <ItemTemplate>
                                                        <asp:CheckBox ID="chkSelect" runat="server" />
                                                        <asp:HiddenField ID="hdnChallanId" runat="server" Value='<%# DataBinder.Eval(Container.DataItem, "ChallanId").ToString() %>' />
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:BoundField HeaderText="" DataField="ChallanId" Visible="false" ReadOnly="true" />
                                                <asp:BoundField HeaderText="Challan No" DataField="ChallanNo" />
                                                <asp:BoundField HeaderText="Challan Date" DataField="ChallanDate" />
                                                <asp:BoundField HeaderText="Transport Company" DataField="TransportCompany" />
                                                <asp:BoundField HeaderText="Contractor Company" DataField="ContractorCompany" />
                                                <asp:BoundField HeaderText="Weight" DataField="CFT" />
                                                <asp:BoundField HeaderText="Truck" DataField="TruckNo" />
                                                <asp:BoundField HeaderText="Material" DataField="Material" />
                                                <asp:BoundField HeaderText="Driver" DataField="Driver" />
                                                <asp:BoundField HeaderText="Cleaner" DataField="Cleaner" />
                                            </Columns>
                                            <FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
                                            <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" />
                                            <PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" />
                                            <RowStyle BackColor="#DEDFDE" ForeColor="Black" />
                                            <SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
                                            <SortedAscendingCellStyle BackColor="#F1F1F1" />
                                            <SortedAscendingHeaderStyle BackColor="#594B9C" />
                                            <SortedDescendingCellStyle BackColor="#CAC9C9" />
                                            <SortedDescendingHeaderStyle BackColor="#33276A" />
                                        </asp:GridView>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </center>
                </div>
            </asp:Panel>
            <asp:Panel ID="panBillView" runat="server" Visible="false">
                <div id="dvSearch" runat="server">
                    <hr />
                    <p>
                    </p>
                    <table>
                        <tr><td>Select Transport Company</td>
                <td>
                 <asp:DropDownList ID="ddlTransport" runat="server" Width="93%" AutoPostBack="true" 
                        onselectedindexchanged="ddlTransport_SelectedIndexChanged">
                 <asp:ListItem Selected="True" Value="0" Text="Please Select">
                 </asp:ListItem>
                                </asp:DropDownList>
                </td>
                            <td>
                                Select Bill No
                            </td>
                            <td>
                                <asp:DropDownList ID="ddlBillNos" runat="server">
                                </asp:DropDownList>
                            </td>
                            <td>
                                <asp:Button ID="btnViewBill" runat="server" Text="View Bill" OnClick="btnViewBill_Click"
                                    SkinID="DefaultButton" />
                                     <asp:Button ID="btnDeleteBill" runat="server" Text="Delete Bill" OnClick="btnDeleteBill_Click"
                                    SkinID="DefaultButton" />
                                    <ajaxToolkit:ConfirmButtonExtender ID="delbtnext" runat="server" ConfirmText="Are you sure you want to delete this bill no? After deleting you will have no longer access to it.Do you wish to continue?" TargetControlID="btnDeleteBill"></ajaxToolkit:ConfirmButtonExtender>
                            </td>
                        </tr>
                    </table>
                </div>
            </asp:Panel>
        </center>
    </div>
    <script language="javascript" type="text/javascript">
        Sys.Application.add_load(DisableControl);
    </script>
</asp:Content>
